﻿<UserControl x:Class="HighLandirect.Presentation.Views.CustomerView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:c="clr-namespace:HighLandirect.Presentation.Converters"
             xmlns:p="clr-namespace:HighLandirect.Presentation.Properties"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:vm="clr-namespace:HighLandirect.Applications.ViewModels;assembly=HighLandirect.Applications"
             xmlns:f="clr-namespace:Microsoft.International.Windows.Controls;assembly=YomiganaWPFTextBox"
             mc:Ignorable="d" d:DataContext="{d:DesignInstance vm:CustomerViewModel}"
             MinWidth="200" MinHeight="50">
    <Grid >
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition Width="40" />
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition Width="*" />
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        <Label Content="{x:Static p:Resources.CustNo}" Grid.Column="0" Grid.Row="0" />
        <TextBox Text="{Binding Customer.CustNo, UpdateSourceTrigger=PropertyChanged, ValidatesOnExceptions=True,
                        ValidatesOnDataErrors=True, NotifyOnValidationError=True}"
                 MaxLength="4" Grid.Column="1" HorizontalAlignment="Stretch" FontSize="16" Margin="0,11,0,0" Width="111" />

        <Label Content="{x:Static p:Resources.CustName}" Grid.Column="0" Grid.Row="1" />
        <f:YomiganaWPFTextBox x:Name="CustName" Text="{Binding Customer.CustName, UpdateSourceTrigger=PropertyChanged, ValidatesOnExceptions=True,
                        ValidatesOnDataErrors=True, NotifyOnValidationError=True}"
                 MaxLength="30" Grid.Column="1" Grid.Row="1" HorizontalAlignment="Stretch" 
                              BindingControl="Furigana" MinWidth="100" Height="30" Margin="0,14,0,0" FontSize="16" />

        <Label Content="{x:Static p:Resources.Furigana}" Grid.Column="0" Grid.Row="2" />
        <TextBox Name="Furigana" Text="{Binding Customer.Furigana, UpdateSourceTrigger=PropertyChanged, ValidatesOnExceptions=True,
                        ValidatesOnDataErrors=True, NotifyOnValidationError=True}"
                 MaxLength="30" Grid.Column="1" Grid.Row="2" HorizontalAlignment="Stretch" FontSize="16" Margin="0,11,0,0" Width="111" />
        <TextBox Text="{Binding Customer.Keisho, UpdateSourceTrigger=PropertyChanged, ValidatesOnExceptions=True,
                        ValidatesOnDataErrors=True, NotifyOnValidationError=True}"
                 MaxLength="1" Grid.Column="2" Grid.Row="1" MinWidth="30" FontSize="16" Grid.ColumnSpan="2" Margin="11,11,0,0" Width="20" />

        <Label Content="{x:Static p:Resources.PostalCD}" Grid.Column="3" />
        <TextBox Name="PostalCD" Text="{Binding Customer.PostalCD, Converter={x:Static c:PostalCdConverter.Default}, UpdateSourceTrigger=PropertyChanged, ValidatesOnExceptions=True,
                        ValidatesOnDataErrors=True, NotifyOnValidationError=True}"
                 MaxLength="8" Grid.Column="4" HorizontalAlignment="Stretch" DataContext="{Binding}" KeyUp="TextBox_KeyUp" FontSize="16" Margin="0,11,0,0" Width="129">
        </TextBox>

        <Label Content="{x:Static p:Resources.CityName}" Grid.Column="3" Grid.Row="1" />
        <TextBox Text="{Binding Customer.CityName, UpdateSourceTrigger=PropertyChanged, ValidatesOnExceptions=True,
                        ValidatesOnDataErrors=True, NotifyOnValidationError=True}"
                 MaxLength="200" Grid.Column="4" Grid.Row="1" HorizontalAlignment="Stretch" DataContext="{Binding}" FontSize="16" Margin="0,11,0,0" Width="129" />

        <Label Content="{x:Static p:Resources.Address1}" Grid.Column="3" Grid.Row="2" />
        <TextBox Name="Address1" Text="{Binding Customer.Address1, UpdateSourceTrigger=PropertyChanged, ValidatesOnExceptions=True,
                        ValidatesOnDataErrors=True, NotifyOnValidationError=True}"
                 MaxLength="200" Grid.Column="4" Grid.Row="2" HorizontalAlignment="Stretch" DataContext="{Binding}" FontSize="16" Margin="0,11,0,0" Width="129" />
        <TextBox Text="{Binding Customer.Address2, UpdateSourceTrigger=PropertyChanged, ValidatesOnExceptions=True,
                        ValidatesOnDataErrors=True, NotifyOnValidationError=True}"
                 MaxLength="200" Grid.Column="4" Grid.Row="3" HorizontalAlignment="Stretch" DataContext="{Binding}" FontSize="16" Margin="0,11,0,0" Width="129" />
        <TextBox Text="{Binding Customer.Address3, UpdateSourceTrigger=PropertyChanged, ValidatesOnExceptions=True,
                        ValidatesOnDataErrors=True, NotifyOnValidationError=True}"
                 MaxLength="200" Grid.Column="4" Grid.Row="4" HorizontalAlignment="Stretch" DataContext="{Binding}" FontSize="16" Margin="0,11,0,0" Width="129" />
        <TextBox Text="{Binding Customer.Address4, UpdateSourceTrigger=PropertyChanged, ValidatesOnExceptions=True,
                        ValidatesOnDataErrors=True, NotifyOnValidationError=True}"
                 MaxLength="200" Grid.Column="4" Grid.Row="5" HorizontalAlignment="Stretch" DataContext="{Binding}" FontSize="16" Margin="0,11,0,0" Width="129" />

        
        <Label Content="{x:Static p:Resources.Phone}" Grid.Row="4" />
        <TextBox Text="{Binding Customer.Phone, UpdateSourceTrigger=PropertyChanged, ValidatesOnExceptions=True,
                        ValidatesOnDataErrors=True, NotifyOnValidationError=True}"
                 MaxLength="13" Grid.Column="1" Grid.Row="4" HorizontalAlignment="Stretch" DataContext="{Binding}" FontSize="16" Margin="0,11,0,0" Width="111" />

        <Label Content="{x:Static p:Resources.Fax}" Grid.Row="5" />
        <TextBox Text="{Binding Customer.Fax, UpdateSourceTrigger=PropertyChanged, ValidatesOnExceptions=True,
                        ValidatesOnDataErrors=True, NotifyOnValidationError=True}"
                 MaxLength="12" Grid.Column="1" Grid.Row="5" HorizontalAlignment="Stretch" DataContext="{Binding}" FontSize="16" Margin="0,11,0,0" Width="111" />

        <CheckBox Grid.Row="6" Grid.Column="3" Content="{x:Static p:Resources.Label}" IsChecked="{Binding Customer.Label}" Height="25" Margin="0,11,0,0" FontSize="14" />
        <CheckBox Grid.Row="6" Grid.Column="4" Content="顧客一覧に出さない" IsChecked="{Binding Customer.Delete}" Height="25" Margin="0,11,0,0" FontSize="14" />
        
        <Label Content="{x:Static p:Resources.MailAddress}" Grid.Row="6" />
        <TextBox Text="{Binding Customer.MailAddress, UpdateSourceTrigger=PropertyChanged, ValidatesOnExceptions=True,
                        ValidatesOnDataErrors=True, NotifyOnValidationError=True}"
                 MaxLength="200" Grid.Column="1" Grid.Row="6" HorizontalAlignment="Stretch" DataContext="{Binding}" FontSize="16" Margin="0,11,0,0" Width="111" />
        
        <Label Content="{x:Static p:Resources.Memo}" Grid.Row="8" />
        <TextBox Text="{Binding Customer.Memo, UpdateSourceTrigger=PropertyChanged, ValidatesOnExceptions=True,
                        ValidatesOnDataErrors=True, NotifyOnValidationError=True}"
                 MaxLength="200" Grid.Column="1" Grid.Row="8" Grid.ColumnSpan="4" HorizontalAlignment="Stretch" DataContext="{Binding}" FontSize="16" Margin="0,11,0,0" Width="378" />
        <Label Content="最終荷主日" Grid.Row="7" Grid.Column="0"/>
        <TextBox MaxLength="200" Text="{Binding Customer.LatestSend, UpdateSourceTrigger=PropertyChanged, ValidatesOnExceptions=True, ValidatesOnDataErrors=True, NotifyOnValidationError=True}" Grid.Column="1" Grid.Row="7" FontSize="16" Margin="0,11,0,0" Width="111" />
        <Label Content="最終宛先日" Grid.Row="7" Grid.Column="3"/>
        <TextBox MaxLength="200" Text="{Binding Customer.LatestResceive, UpdateSourceTrigger=PropertyChanged, ValidatesOnExceptions=True, ValidatesOnDataErrors=True, NotifyOnValidationError=True}" Grid.Column="4" Grid.Row="7" FontSize="16" />
    </Grid>
</UserControl>
